﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class _Default : System.Web.UI.Page
{
    Formula formular;
    FormulaDAO formularDao;
    DataSet dataUpdate;
    protected void Page_Load(object sender, EventArgs e)
    {
        formular = new Formula();
        formularDao = new FormulaDAO();
        dataUpdate = new DataSet();
        if (IsPostBack == false)
        {
            LabelID.Text = formular.Id;
            LabelID.Text = dataUpdate.Tables[0].Rows[0][0].ToString().ToUpper();
            txtName.Text = dataUpdate.Tables[0].Rows[0][1].ToString();
            txtCode.Text = dataUpdate.Tables[0].Rows[0][2].ToString();           
            txtDescription.Text = dataUpdate.Tables[0].Rows[0][3].ToString();
            //Calendar1. = dataUpdate.Tables[0].Rows[0][4].ToString();
        }
    }
    protected void reset_Click(object sender, EventArgs e)
    {
        txtName.Text = "";
        txtCode.Text = "";
        txtDescription.Text = "";
    }
    protected void submit_Click(object sender, EventArgs e)
    {
        
    }
    private void update()
    {
        formular.Id = LabelID.Text;
        formular.Name = txtName.Text;
        formular.Code = int.Parse(txtCode.Text);
     //   formular.Description = 
        formular.Code = int.Parse(txtCode.Text);
        formularDao.update(formular);
        Response.Redirect("nutrient.aspx");
    }
}